package com.lap.auth.domain.job.service;

import com.lap.auth.domain.job.Job;
import com.lap.auth.domain.job.repository.JobRepository;
import com.lap.auth.shared.errors.UserError;
import com.lap.framework.common.exception.BizException;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class JobValidator {

  private final JobRepository jobRepository;

  public Job assertJobExists(Integer id) {
    return jobRepository
        .findById(id)
        .orElseThrow(() -> BizException.newBiz(UserError.JOB_NOT_FOUND));
  }
}
